syms L  W x  Li Wi R Ri
f = (Li+Wi*x)*(log(Li+Wi*x)-log(L+W*x));
g = diff(f,x);
simple(g);

fr = (Ri-Wi*x)*(log(Ri-Wi*x)-log(R-W*x));
gr = diff(fr, x);
simple(gr);

disp(g);
disp(gr);

